home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Reference Manual / Prograph Reference 5-7 / Prograph Reference 5-7.rsrc / TEXT_165.txt < prev    next >
Encoding:
Text File  |  1995-10-25  |  7.7 KB  |  326 lines

  1.  
  2.  Lists
  3.  
  4.  
  5. _________________________________________________
  6.  
  7.                       (in)     *288*
  8.  
  9.  
  10. Input names: aList;  Item;  [StartIndex]
  11.  
  12. Input types: list;  <any>;  [integer]
  13.  
  14. Defaults: StartIndex = 1
  15.  
  16. Output names: FoundIndex
  17.  
  18. Output types: integer
  19.  
  20. Description:     FoundIndex is the position in aList of the first occurrence of Item after the position specified by StartIndex. FoundIndex is 0 if Item does not occur in the list. Note that a list element is found only if it equals Item in the sense defined by the = primitive.
  21.  
  22. See also:  (length), (join)
  23.  
  24.  
  25. _________________________________________________
  26.  
  27.                                 (join)     *288*
  28.  
  29.  
  30. Input names: List1;  List2;  [List3;  ...]
  31.  
  32. Input types: list;  list;  [list;  ...]
  33.  
  34. Output names: aList
  35.  
  36. Output types: list
  37.  
  38. Description:     AList is the concatenation of List1, List2, ‚Ķ .
  39.  
  40. See also:  (in), (join)
  41.  
  42.  
  43. _________________________________________________
  44.  
  45.                                    (length)     *288*
  46.  
  47.  
  48. Input types: list
  49.  
  50. Output types: integer
  51.  
  52. Description:     Length is the length (number of elements) of aList.
  53.  
  54. See also:  (in), (join)
  55.  
  56.  
  57. _________________________________________________
  58.  
  59.                                     attach-l     *289*
  60.  
  61.  
  62. Input names: Element1;  [Element2;  ...];  aList
  63.  
  64. Input types: <any>;  [<any>;  ...];  list
  65.  
  66. Output names: NewList
  67.  
  68. Output types: list
  69.  
  70. Description:     NewList is the concatenation of lists (Element1... ) and aList.
  71.  
  72. See also:  detach-l, attach-r, detach-r,detach-nth
  73.  
  74.  
  75. _________________________________________________
  76.  
  77.                                  attach-r     *289*
  78.  
  79.  
  80. Input names: aList;  Element1;  [Element2;  ...]
  81.  
  82. Input types: list;  <any>;  [<any>; ...]
  83.  
  84. Output names: NewList
  85.  
  86. Output types: list
  87.  
  88. Description:     NewList is the concatenation of lists aList and (Element1...).
  89.  
  90. See also:  attach-l, detach-l, detach-r,detach-nth
  91.  
  92.  
  93. _________________________________________________
  94.  
  95.                                detach-l     *289*
  96.  
  97.  
  98.  
  99. Input names: aList
  100.  
  101. Input types: list
  102.  
  103. Output names: Element1;  [Element2;  ...; ElementN];  Tail
  104.  
  105. Output types: <any>;  [<any>;  ...; <any>];  list
  106.  
  107. Description:     Length of aList must be at least N. Element1, ‚Ķ, ElementN are the first N elements of aList, and Tail is the list of remaining elements of aList.
  108.  
  109. See also:  attach-l, attach-r, detach-r,detach-nth
  110.  
  111.  
  112. _________________________________________________
  113.  
  114.                                    detach-nth     *290*
  115.  
  116.  
  117. Input types: list;  integer
  118.  
  119. Output types: list;  <any>
  120.  
  121. Description:     Element is the Nth element of InList. OutList is the list that results from removing the Nth element from InList.
  122.  
  123. See also:  attach-l, detach-l, attach-r, detach-r
  124.  
  125.  
  126. _________________________________________________
  127.  
  128.                                    detach-r     *290*
  129.  
  130.  
  131. Input names: InList
  132.  
  133. Input types: list
  134.  
  135. Output names: OutList; Element1;  [Element2;  ...; ElementN]
  136.  
  137. Output types: list;  <any>;  [<any>;  ...; <any>]
  138.  
  139. Description:     Length of InList must be at least N. Element1, ‚Ķ, ElementN are the last N elements of InList, and OutList is the list of remaining elements of InList.
  140.  
  141. See also:  attach-l, detach-l, attach-r, detach-nth
  142.  
  143.  
  144. _________________________________________________
  145.  
  146.                                     find-sorted     *290*
  147.  
  148.  
  149. Input names: List; Item; [AttributeName]
  150.  
  151. Input types: list; string | number; [string]
  152.  
  153. Output names: Found; Index
  154.  
  155. Output types: boolean, integer
  156.  
  157. Description: Uses a binary search to find Item in a sorted list. With AttributeName, the list must be a list of instances. If Item is not found, Index is the location in the list where Item can be inserted. The advantage to searching sorted lists using find-sorted (as opposed to find-instance) is that find-sorted is faster because it uses a binary search.
  158.  
  159.  
  160. _________________________________________________
  161.  
  162.                             get-nth     *291*
  163.  
  164.  
  165. Input names: aList;  N1;  [N2; ‚Ķ]
  166.  
  167. Input types: list;  integer;  [integer; ‚Ķ]
  168.  
  169. Output types: <any>
  170.  
  171. Description:     Element is the indexed element of aList. With inputs of N1 and N2, get-nth returns the N2th element of the N1th list in aList.
  172.  
  173. See also:  set-nth, set-nth!
  174.  
  175.  
  176. _________________________________________________
  177.  
  178.                                            insert-nth     *291*
  179.  
  180.  
  181.  
  182. Input types: list; any; integer
  183.  
  184. Output types: list
  185.  
  186. Description: NewList is the list obtained by inserting Element into OldList at the Index position. If Index is 0, Element is the first item in NewList.
  187.  
  188.  
  189. _________________________________________________
  190.  
  191.                                  make-list     *292*
  192.  
  193.  
  194. Input names: Length;  [Start;  [Step]]
  195.  
  196. Input types: integer; [<number>; [<number>]]
  197.  
  198. Defaults: Step = 0
  199.  
  200. Output names: aList
  201.  
  202. Output types: list
  203.  
  204. Description:     aList is a list of length Length. If Start is not present, all elements of aList are NULL. If Step is not present, all the elements are Start. Otherwise, the first element of aList is Start, and every other element equals the element to its left plus Step.
  205.  
  206. See also:  pack
  207.  
  208.  
  209. _________________________________________________
  210.  
  211.                                              pack     *292*
  212.  
  213.  
  214. Input names: Element1;  [Element2;  ...]
  215.  
  216. Input types: <any>;  [<any>;  ...]
  217.  
  218. Output names: aList
  219.  
  220. Output types: list
  221.  
  222. Description: AList is the list (Element1 ... ).
  223.  
  224. See also:  make-list, unpack
  225.  
  226.  
  227. _________________________________________________
  228.  
  229.                                reverse     *292*
  230.  
  231.  
  232. Input types: list
  233.  
  234. Output types: list
  235.  
  236. Description:     OutList is the reverse of InList.
  237.  
  238.  
  239.  
  240. _________________________________________________
  241.  
  242.                                              set-nth     *293*
  243.  
  244.  
  245. Input names: InList;  Item;  N1;  [N2; ‚Ķ]
  246.  
  247. Input types: list;  <any>;  integer;  [integer; ‚Ķ]
  248.  
  249. Output types: list
  250.  
  251. Description:     Replaces the indexed element of InList by Item to produce the OutList list. If indeces are N1 and N2, set-nth returns a list with the N2nd element of the N1st list in InList replaced by Item.
  252.  
  253. See also:  get-nth, set-nth!
  254.  
  255.  
  256. _________________________________________________
  257.  
  258.                                                    set-nth!     *293*
  259.  
  260.  
  261. Input names: aList;  Item;  N1;  [N2; ‚Ķ]
  262.  
  263. Input types: list;  <any>;  integer;  [integer; ‚Ķ]
  264.  
  265. Output types: list
  266.  
  267. Description:     Replaces the indexed element of aList by Item. The indeces permit identifying an element within nested lists. Use this primitive with care, as it modifies its input data directly, rather than modifying copies of that data. Its side effects that can affect results of other operations which independently reference the same data. Use synchros to ensure desired results.
  268.  
  269. Side effect:     The input list is modified!
  270.  
  271. See also:  set-nth, get-nth
  272.  
  273.  
  274. _________________________________________________
  275.  
  276.                        sort     *293*
  277.  
  278.  
  279. Input names: InList; boolean; [AttributeName]
  280.  
  281. Input types: list; boolean; [string]
  282.  
  283. Output types: list
  284.  
  285. Description: Without AttributeName, sorts a list of numbers or strings. Otherwise sort a list of instances by AttributeName. The second input indicates whether duplicate items in the list should be eliminated. Default behavior is to retain duplicate items. 
  286.  
  287.  
  288. _________________________________________________
  289.  
  290.                                split-nth     *294*
  291.  
  292.  
  293. Input types: list;  integer
  294.  
  295. Output types: list;  list
  296.  
  297. Description:     Prefix and Rest are, respectively, the list consisting of the first N elements of aList and the remaining elements of aList.
  298.  
  299.  
  300. _________________________________________________
  301.  
  302.                                           unpack     *294*
  303.  
  304.  
  305. Input names: aList
  306.  
  307. Input types: list
  308.  
  309. Output names: Element1;  [Element2;  ...; ElementN]
  310.  
  311. Output types: <any>;  [<any>;  ...]
  312.  
  313. Description:     Length of aList must be at least N. Element1, ..., ElementN are the first N elements of aList.
  314.  
  315. Example:    
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324. See also:  make-list, pack
  325.  
  326.